<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" template="#{desktopMBean.showTemplate}">
	<ui:define name="content">
		<h:form id="form">
			<p:panel header="Recherche" toggleable="true">
				<p:messages id="messages" />
				<p:autoComplete id="autoCity" value="#{searchController.citySelected}" completeMethod="#{searchController.searchCity}" dropdown="true"
					queryDelay="10" var="city" itemLabel="#{city.label} (#{city.codePostal})" itemValue="#{city.label}">
					<p:ajax event="itemSelect" update="resultPanel" listener="#{searchController.handleModifFiltre}" />
				</p:autoComplete>
			</p:panel>
			<p:panel id="resultPanel">
				<p:dataTable id="results" var="result" value="#{searchController.planings}" rowKey="#{result.model}"
					selection="#{searchController.planingSelected}" selectionMode="single">
					<f:facet name="header">  
			            Click "View" button after selecting a row to see details  
			        </f:facet>

					<p:column headerText="Société">  
			            #{result.company.label}  
			        </p:column>

					<p:column headerText="Ville">  
			            #{result.company.adress.city.label}  
			        </p:column>
				</p:dataTable>
			</p:panel>
			<p:inputText value="#{searchController.citySelected}"/>
		</h:form>
	</ui:define>
</ui:composition>